#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
struct js{int x,id;}a[400010];
struct sj{int x,y;}x[400010],y[400010];
int n,m1,m2;
int tag1[800010],min1[800010],tag2[800010],min2[800010];
int b[400010];
int se[400010],ze[400010];
void read(int &x){
	x=0;int f=1;char c=0;
	while(c<'0'||c>'9'){
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=x*10+c-'0';
		c=getchar();
	}
	x=x*f;
}
inline bool cmp(js a,js b){return a.x<b.x;}
inline bool cmp1(sj a,sj b){return a.x<b.x;}
void down1(int p,int l,int r){
	min1[p*2]+=tag1[p];
	min1[p*2+1]+=tag1[p];
	tag1[p*2]+=tag1[p];
	tag1[p*2+1]+=tag1[p];
	tag1[p]=0;return;
}
void down2(int p,int l,int r){
	min2[p*2]+=tag2[p];
	min2[p*2+1]+=tag2[p];
	tag2[p*2]+=tag2[p];
	tag2[p*2+1]+=tag2[p];
	tag2[p]=0;return;
}
void insert1(int p,int l,int r,int x,int y){
	if(r<x||l>y) return;
	if(x<=l&&r<=y){
		tag1[p]++;
		min1[p]++;
		return;
	}
	int mid=(l+r)>>1ll;
	down1(p,l,r);
	insert1(p*2,l,mid,x,y);
	insert1(p*2+1,mid+1,r,x,y);
	min1[p]=max(min1[p*2],min1[p*2+1]);
}
void insert2(int p,int l,int r,int x,int y){
	if(r<x||l>y) return;
	if(x<=l&&r<=y){
		tag2[p]++;
		min2[p]++;
		return;
	}
	int mid=(l+r)>>1ll;
	down2(p,l,r);
	insert2(p*2,l,mid,x,y);
	insert2(p*2+1,mid+1,r,x,y);
	min2[p]=max(min2[p*2],min2[p*2+1]);
}
int query1(int p,int l,int r,int x,int y){
	if(r<x||l>y) return 0;
	if(x<=l&&r<=y) return min1[p];
	int mid=(l+r)>>1ll;
	down1(p,l,r);
	int q1=query1(p*2,l,mid,x,y);
	int q2=query1(p*2+1,mid+1,r,x,y);
	return max(q1,q2);
}
int query2(int p,int l,int r,int x,int y){
	if(r<x||l>y) return 0;
	if(x<=l&&r<=y) return min2[p];
	int mid=(l+r)>>1ll;
	down2(p,l,r);
	int q1=query2(p*2,l,mid,x,y);
	int q2=query2(p*2+1,mid+1,r,x,y);
	return max(q1,q2);
}
signed main()
{
	int i,j,maxn=0;
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	read(n);read(m1);read(m2);
	for(i=1;i<=m1*2;i+=2){
		read(a[i].x);read(a[i+1].x);
		a[i].id=i;a[i+1].id=i+1;
	}
	for(i=m1*2+1;i<=m1*2+m2*2;i+=2){
		read(a[i].x);read(a[i+1].x);
		a[i].id=i;a[i+1].id=i+1;
	}
	sort(a+1,a+m1*2+m2*2+1,cmp);
	for(i=1;i<=m1*2+m2*2;i++) b[a[i].id]=i;
	for(i=1;i<=m1;i++){
		x[i].x=b[(i-1)*2+1];
		x[i].y=b[(i-1)*2+2];
	}
	for(i=m1+1;i<=m1+m2;i++){
		y[i-m1].x=b[(i-1)*2+1];
		y[i-m1].y=b[(i-1)*2+2];
	}
	sort(x+1,x+m1+1,cmp1);
	sort(y+1,y+m2+1,cmp1);
	for(i=0;i<=n;i++){
		memset(tag1,0,sizeof(tag1));
		memset(tag2,0,sizeof(tag2));
		memset(min1,0,sizeof(min1));
		memset(min2,0,sizeof(min2));
		int s=0;
		for(j=1;j<=m1;j++){
			if(query1(1,1,2*(m1+m2),x[j].x,x[j].y)<i){
				s++;
				insert1(1,1,2*(m1+m2),x[j].x,x[j].y);
			}
		}
		for(j=1;j<=m2;j++){
			if(query2(1,1,2*(m1+m2),y[j].x,y[j].y)<n-i){
				s++;
				insert2(1,1,2*(m1+m2),y[j].x,y[j].y);
			}
		}
		maxn=max(maxn,s);
	}
	cout<<maxn<<endl;
	fclose(stdin);
	fclose(stdout);
	return 0;
}
